<template>
	<view>
		<view v-for="(item,index) in list" @click="incomeDefinite(item.date)">
			<view class="time">{{item.date}}</view>
			<view class="box">
				<view class="detail">
					<view class="money"><text>￥</text>{{item.price}}</view>
					<view class="name">{{item.order_num==0?'今日暂无收益':'共收入'+item.order_num+'笔订单'}}</view>
				</view>
				<view class="wlIcon-fanhui2 next-icon"></view>
			</view>
		</view>
		<view class="null"></view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				page: 1,
				list: [],
				url: getApp().globalData.baseurl,
				sid: ''
			}
		},
		onLoad(e) {
			this.sid = e.sid
			this.page = 1
			this.list = []
			this.getData();
		},
		methods: {
			incomeDefinite(date) {
				uni.navigateTo({
					url: '/pages/new/incomeDetails/incomeDetails?date=' + date
				})
			},
			getData() {
				uni.showLoading({
					title: '加载中',
					mask: true
				})
				uni.request({
					url: this.url + '/api/shop.Shop/income_record',
					method: "POST",
					data: {
						page: this.page
					},
					header: {
						'token': uni.getStorageSync('wanlshop:user').token,
					},
					success: (res) => {
						uni.hideLoading();
						console.log(res.data);
						this.list = this.list.concat(res.data.list)
					}
				})
			},
		},
		onReachBottom() {
			this.page += 1;
			this.getData();
		},
	}
</script>

<style lang="scss">
	.time {
		font-size: 26rpx;
		color: #999999;
		margin-left: 58rpx;
		line-height: 98rpx;
	}

	.box {
		width: 690rpx;
		height: 162rpx;
		background-color: #fff;
		margin-left: 26rpx;
		border-radius: 20rpx;
		display: flex;
		justify-content: space-between;
		align-items: center;

		.detail {
			margin-left: 28rpx;

			.money {
				font-size: 40rpx;

				text {
					font-size: 30rpx;
				}
			}

			.name {
				font-size: 26rpx;
				color: #999999;
				margin-top: 4rpx;
			}
		}

		.next-icon {
			font-size: 30rpx;
			margin-right: 20rpx;
			color: #999999;
		}
	}

	.null {
		width: 750rpx;
		height: 30rpx;
	}
</style>